# (c) Epimorphics Ltd, 2012

@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl:  <http://www.w3.org/2002/07/owl#> .
@prefix xsd:  <http://www.w3.org/2001/XMLSchema#> .
@prefix dct:  <http://purl.org/dc/terms/> .
@prefix dc:   <http://purl.org/dc/elements/1.1/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix version:  <http://purl.org/linked-data/version#> .
@prefix ldp:  <http://www.w3.org/ns/ldp#> .
@prefix ssd:  <http://www.w3.org/ns/sparql-service-description#> .
@prefix vs:   <http://www.w3.org/2003/06/sw-vocab-status/ns#> .
@prefix void: <http://rdfs.org/ns/void#> .
@prefix prov: <http://www.w3.org/ns/prov#> .

@prefix reg:  <http://purl.org/linked-data/registry#> .

<http://purl.org/linked-data/registry>  a owl:Ontology;
    rdfs:label "Registry ontology"@en;
    rdfs:comment "Core ontology for linked data registry services. Based on ISO19135 but heavily modified to suit Linked Data representations and applications."@en;
    dct:creator  "Dave Reynolds";     # As a string to enable documentation tool to work
    dct:date     "2012-11-11"^^xsd:date;
    dct:modified "2015-04-29"^^xsd:date;
    owl:versionInfo "0.4";
    # For documentation tools
    dct:description "Core ontology for linked data registry services. Based on ISO19135 but heavily modified to suit Linked Data representations and applications."@en;
    .

# -- Registers ------------------------------------------------------

reg:Register    a owl:Class;
    rdfs:subClassOf version:VersionedThing, ldp:Container, void:Dataset;
    rdfs:label "Register"@en;
    rdfs:comment "Represents a collection of registered items, together with some associated governance regime. If one or more licenses is stated then each license applies to all the entries in the register. "@en;
    rdfs:subClassOf [owl:onProperty rdfs:label;       owl:minCardinality 1];
    rdfs:subClassOf [owl:onProperty dct:description;  owl:minCardinality 1];
    rdfs:subClassOf [owl:onProperty reg:owner;        owl:cardinality    1];
    rdfs:subClassOf [owl:onProperty reg:manager;      owl:cardinality    1];
    rdfs:subClassOf [owl:onProperty dct:license;      owl:minCardinality 0];
    rdfs:subClassOf [owl:onProperty reg:containedItemClass; owl:minCardinality 0];
    rdfs:subClassOf [owl:onProperty reg:operatingLanguage;  owl:minCardinality 0];
    rdfs:subClassOf [owl:onProperty reg:governancePolicy;   owl:minCardinality 0];
    rdfs:subClassOf [owl:onProperty reg:validationQuery;    owl:minCardinality 0];
    rdfs:subClassOf [owl:onProperty dct:modified;           owl:maxCardinality 1];
    rdfs:subClassOf [owl:onProperty void:openSearchDescription; owl:minCardinality 0];
    rdfs:subClassOf [owl:onProperty void:uriLookupEndpoint; owl:minCardinality 0];
    rdfs:subClassOf [owl:onProperty void:uriSpace; 	    owl:maxCardinality 1];
    rdfs:subClassOf [owl:onProperty void:exampleResource;   owl:minCardinality 0];
    .

reg:operatingLanguage    a owl:ObjectProperty;
    rdfs:label "operating language"@en;
    rdfs:comment "Indicates a language supported by the register and the items within it. The language should be indicated by a resource within a well-maintained URI set such as the Library of Congress language URIs e.g. http://id.loc.gov/vocabulary/iso639-1/en"@en;
    rdfs:domain reg:Register;
    rdfs:range  rdfs:Resource;
    .

reg:owner a owl:ObjectProperty;
    rdfs:label "owner"@en;
    rdfs:comment "The owner of the register, may be a person (foaf:Person) or an organization (org:Organization). The owner has final authority over the contents of the regster."@en;
    rdfs:subPropertyOf dct:publisher;
    rdfs:domain reg:Register;
    rdfs:range foaf:Agent;
    .

reg:manager a owl:ObjectProperty;
    rdfs:label "manager"@en;
    rdfs:comment "The manager of the register, may be a person (foaf:Person) or an organization (org:Organization). Operates the register on behalf of the owner, makes day to day decisions on acceptance of entries based on agreed principles but it may be possible to appeal to the owner to override a decision by the manager."@en;
    rdfs:domain reg:Register;
    rdfs:range foaf:Agent;
    .

reg:containedItemClass a owl:ObjectProperty;
    rdfs:label "contained item class"@en;
    rdfs:comment "A class of entities that can occur in this register"@en;
    rdfs:domain reg:Register;
    rdfs:range  owl:Class;
    .

reg:subregister a owl:ObjectProperty;
    rdfs:label "subregister"@en;
    rdfs:comment "Indicates a register that is itself an entry in this principle register."@en;
    rdfs:domain reg:Register;
    rdfs:range  reg:Register;
    .

reg:governancePolicy a owl:ObjectProperty;
    rdfs:label "governance policy"@en;
    rdfs:comment "A resource, such as a web accessible-document, which describes the governance policy applicable to this register."@en;
    rdfs:domain reg:Register;
    rdfs:range  rdfs:Resource;
    .

# -- RegisterItems ------------------------------------------------------

reg:RegisterItem    a owl:Class;
    rdfs:subClassOf version:VersionedThing;
    rdfs:label "RegisterItem"@en;
    rdfs:comment "A metadata record for an entry in a register. Note that cardinality constraints can be met by sub-properties, for example an item with a skos:prefLabel implies an rdfs:label and so meets the cardinality constraint on rdfs:label."@en;
    rdfs:subClassOf [owl:onProperty rdfs:label;        owl:minCardinality 1];
    rdfs:subClassOf [owl:onProperty dct:description;   owl:minCardinality 0];
    rdfs:subClassOf [owl:onProperty dct:dateSubmitted; owl:cardinality    1];
    rdfs:subClassOf [owl:onProperty dct:dateAccepted;  owl:maxCardinality 1];
    rdfs:subClassOf [owl:onProperty reg:status;        owl:minCardinality 1];
    rdfs:subClassOf [owl:onProperty reg:definition;    owl:cardinality    1];
    rdfs:subClassOf [owl:onProperty reg:submitter;     owl:cardinality    1];
    rdfs:subClassOf [owl:onProperty reg:category;      owl:minCardinality 0];
    rdfs:subClassOf [owl:onProperty reg:itemClass;     owl:minCardinality 1];
    rdfs:subClassOf [owl:onProperty reg:notation;      owl:maxCardinality 1];
    rdfs:subClassOf [owl:onProperty dct:license;       owl:minCardinality 0];
    rdfs:subClassOf [owl:onProperty reg:predecessor;   owl:minCardinality 0];
    rdfs:subClassOf [owl:onProperty reg:alias;         owl:minCardinality 0];
    rdfs:subClassOf [owl:onProperty reg:representationOf;  owl:minCardinality 0];
    rdfs:subClassOf [owl:onProperty reg:hasView;       owl:minCardinality 0];
    rdfs:subClassOf [owl:onProperty dct:modified;      owl:maxCardinality 1];

    version:rigidProperty reg:register, reg:notation, reg:itemClass, reg:predecessor, reg:submitter;
  .

reg:definition a owl:ObjectProperty;
    rdfs:label "definition"@en;
    rdfs:comment "The entity which has been registered."@en;
    rdfs:domain  reg:RegisterItem;
    rdfs:range   reg:EntityReference;
  .
# TODO  "definition" is ISO19135 terminology but not appropriate for all intended usage (e.g. registering datasets)
#       would prefer reg:item or reg:entity

reg:register a owl:ObjectProperty;
    rdfs:label "register"@en;
    rdfs:comment "The register in which this item has been registered."@en;
    rdfs:domain  reg:RegisterItem;
    rdfs:range   reg:Register;
  .

reg:predecessor a owl:ObjectProperty;
    rdfs:label "predecessor"@en;
    rdfs:comment "An item which has been replaced this one within the register. Should be asserted between hub resources (VersionedThing)."@en;
    rdfs:domain  reg:RegisterItem;
    rdfs:range   reg:RegisterItem;
  .

reg:successor a owl:ObjectProperty;
    rdfs:label "successor"@en;
    rdfs:comment "Indicates the replacement for a superseded item."@en;
    rdfs:domain  reg:RegisterItem;
    rdfs:range   reg:RegisterItem;
    owl:inverseOf reg:predecessor;
  .

reg:category a owl:ObjectProperty;
    rdfs:label "category"@en;
    rdfs:comment "Optional classification for a registered item within one or more SKOS classification schemes to support navigation and discovery. Orthogonal to the structure provided by the register hierarchy which is about governance."@en;
    rdfs:domain  reg:RegisterItem;
    rdfs:range   skos:Concept;
  .

reg:notation    a owl:DatatypeProperty;
    rdfs:label "notation"@en;
    rdfs:comment "A short text string which can be used to denote the register item. Must be unique within the register. If available it should be used as the path segment, relative to the parent register, for the RegisterItem (and for the item itself, if managed). Restricted to be a syntactically legal URI segment (i.e. *pchar)."@en;
    rdfs:domain reg:RegisterItem;
    rdfs:range  xsd:string;
    .

reg:itemClass    a owl:ObjectProperty;
    rdfs:label "item class"@en;
    rdfs:comment "The type of the entity that this record is about. Note that it may be possible to register a non-RDF resource in which case this property provides a way to state the intended class of the entity even though no direct RDF assertion of type is available."@en;
    rdfs:domain reg:RegisterItem;
    rdfs:range  rdfs:Class;
    .

reg:submitter a owl:ObjectProperty;
    rdfs:label "submitter"@en;
    rdfs:comment "The person or organization who originally submitted this register entry. Subsequent chages to the entry may have been made by other agents."@en;
    rdfs:subPropertyOf dct:publisher;
    rdfs:domain reg:RegisterItem;
    rdfs:range foaf:Agent;
    .

reg:annotation a owl:ObjectProperty;
    rdfs:label "annotation"@en;
    rdfs:comment "The URI of a graph of annotation statements associate with this item"@en;
    rdfs:domain reg:RegisterItem;
    .

# -- Status ------------------------------------------------------

reg:status    a owl:ObjectProperty;
    rdfs:label "status"@en;
    rdfs:comment "The status of this register entry"@en;
    rdfs:domain reg:RegisterItem;
    rdfs:range  reg:Status;
    .

reg:Status    a owl:Class;
    rdfs:label "Status"@en;
    rdfs:comment "Open set of status code for entries in a register"@en;
    rdfs:subClassOf skos:Concept;
    .

reg:StatusScheme a skos:ConceptScheme;
    rdfs:label "Status Scheme"@en;
    rdfs:comment "Concept scheme containing registry status codes"@en;
    .

reg:statusNotAccepted a skos:Concept, reg:Status;
    skos:prefLabel "notAccepted"@en;
    rdfs:comment "An entry that should not be visible in the default register listing. Corresponds to ISO 19135:2005 'notValid'"@en;
    skos:topConceptOf reg:StatusScheme;
    .

reg:statusSubmitted a skos:Concept, reg:Status;
    skos:prefLabel "submitted"@en;
    rdfs:comment "A proposed entry which is not yet approved for use for use. Corresponds to ISO 19135:(redraft) 'submitted'"@en;
    skos:inScheme reg:StatusScheme;
    skos:broader  reg:statusNotAccepted;
    .

reg:statusReserved a skos:Concept, reg:Status;
    skos:prefLabel "reserved"@en;
    rdfs:comment "A reserved entry allocated for some as yet undetermined future use."@en;
    skos:inScheme reg:StatusScheme;
    skos:broader  reg:statusNotAccepted;
    .

reg:statusInvalid a skos:Concept, reg:Status;
    skos:prefLabel "invalid"@en;
    rdfs:comment "An entry which has been invalidated due to serious flaws, distinct from retrirement. Corresponds to ISO 19135(redraft) 'invalid'"@en;
    skos:inScheme reg:StatusScheme;
    skos:broader  reg:statusNotAccepted;
    .

reg:statusAccepted a skos:Concept, reg:Status;
    skos:prefLabel "accepted"@en;
    rdfs:comment "An entry that has been accepted for use and is visible in the default register listing. Includes entries that have seen been retired or superseded."@en;
    skos:topConceptOf reg:StatusScheme;
    .

reg:statusValid a skos:Concept, reg:Status;
    skos:prefLabel "valid"@en;
    rdfs:comment "An entry that has been accepted into the register and is deemed fit for use. Corresponds to ISO 19135:2005 'valid'."@en;
    skos:inScheme reg:StatusScheme;
    skos:broader  reg:statusAccepted;
    .

reg:statusExperimental a skos:Concept, reg:Status;
    skos:prefLabel "experimental"@en;
    skos:altlabel "provisional"@en;
    rdfs:comment "An entry that has been accepted into the register temporarily and may be subject to change or withdrawal."@en;
    skos:inScheme reg:StatusScheme;
    skos:broader  reg:statusValid;
    .

reg:statusStable a skos:Concept, reg:Status;
    skos:prefLabel "stable"@en;
    rdfs:comment "An entry that is seen as having a reasonable measure of stability, may be used to mark the full adoption of a previously 'experimental' entry."@en;
    skos:inScheme reg:StatusScheme;
    skos:broader  reg:statusValid;
    .

reg:statusDeprecated a skos:Concept, reg:Status;
    skos:prefLabel "deprecated"@en;
    rdfs:comment "An entry that has been retired or replaced and is no longer to be used."@en;
    skos:inScheme reg:StatusScheme;
    skos:broader  reg:statusAccepted;
    .

reg:statusSuperseded a skos:Concept, reg:Status;
    skos:prefLabel "superseded"@en;
    skos:altlabel "replaced"@en;
    rdfs:comment "An entry that has been replaced by a new alternative which should be used instead.  Corresponds to ISO 19135:2005 'superseded'."@en;
    skos:inScheme reg:StatusScheme;
    skos:broader  reg:statusDeprecated;
    .

reg:statusRetired a skos:Concept, reg:Status;
    skos:prefLabel "retired"@en;
    skos:altlabel "withdrawn"@en;
    rdfs:comment "An entry that has been withdrawn from use.  Corresponds to ISO 19135:2005 'retired'"@en;
    skos:inScheme reg:StatusScheme;
    skos:broader  reg:statusDeprecated;
    .


# -- Lifecycle customization ------------------------------------------------------

reg:nextState a owl:DatatypeProperty;
    rdfs:label "next state"@en;
    rdfs:comment "Gives the label of a state which can follow from this state"@en;
    rdfs:domain reg:Status;
    rdfs:range xsd:string;
    .

reg:priorState a owl:DatatypeProperty;
    rdfs:label "next state"@en;
    rdfs:comment "Gives the label of a state which can precede this state"@en;
    rdfs:domain reg:Status;
    rdfs:range xsd:string;
    .

reg:presentation a owl:DatatypeProperty;
    rdfs:label "presentation"@en;
    rdfs:comment "Presentational hint for showing items with this status"@en;
    rdfs:domain reg:Status;
    rdfs:range xsd:string;
    .

# -- EntityReference ------------------------------------------------------

reg:EntityReference a owl:Class;
    rdfs:label "Entity Reference"@en;
    rdfs:comment "A reference to some internal or external Linked Data resource. The reg:reference gives the URI of the resource being referenced. If a reg:sourceGraph value is present then it is the URI for a named graph within the Registry containing the properties of the referenced entity. If reg:entityVersion is present it gives URI for the particular version:Version of the entity being referenced. Normally only one of reg:sourceGraph and reg:entityVersion is needed since versioned entities are normally stored in the default graph."@en;
    rdfs:subClassOf [owl:onProperty reg:entity;        owl:cardinality 1];
    rdfs:subClassOf [owl:onProperty reg:sourceGraph;   owl:maxCardinality 1];
    rdfs:subClassOf [owl:onProperty reg:entityVersion; owl:maxCardinality 1];
    .

reg:entity a owl:ObjectProperty;
    rdfs:label "entity"@en;
    rdfs:comment "The RDF resource identified by an entity reference"@en;
    rdfs:domain reg:EntityReference;
    rdfs:range  rdfs:Resource;
    .

reg:sourceGraph a owl:ObjectProperty;
    rdfs:label "source graph"@en;
    rdfs:comment "A resource representing an RDF graph (within the Registry's SPARQL dataset) containing the properties of the reference entity. If not present then assume default graph."@en;
    rdfs:domain reg:EntityReference;
    rdfs:range  ssd:Graph;
    .

reg:entityVersion a owl:ObjectProperty;
    rdfs:label "entity version"@en;
    rdfs:comment "Indicates the particular version:Version of the entity being referenced."@en;
    rdfs:domain reg:EntityReference;
    rdfs:range  rdfs:Resource;
    .


# -- Validation ------------------------------------------------------

reg:validationQuery a owl:ObjectProperty;
    rdfs:label "validation query"@en;
    rdfs:comment "A SPARQL ASK query which can be used to validate a proposed entry in this register. Returns true of an error is found."@en;
    rdfs:domain reg:Register;
    rdfs:range  reg:SPARQLAskQuery;
    .

reg:SPARQLQuery a owl:Class;
    rdfs:label "SPARQL query"@en;
    rdfs:comment "Represents a SPARQL query as a reusable resource."@en;
    rdfs:subClassOf [owl:onProperty reg:query; owl:cardinality 1];
    .

reg:SPARQLAskQuery a owl:Class;
    rdfs:label "SPARQL ASK query"@en;
    rdfs:comment "Represents a SPARQL ASK query as might be used for validation."@en;
    rdfs:subClassof reg:SPARQLQuery;
    .

reg:SPARQLSelectQuery a owl:Class;
    rdfs:label "SPARQL SELECT query"@en;
    rdfs:comment "Represents a SPARQL SELECT query."@en;
    rdfs:subClassof reg:SPARQLQuery;
    .

reg:SPARQLConstructQuery a owl:Class;
    rdfs:label "SPARQL CONSTRUCT query"@en;
    rdfs:comment "Represents a SPARQL CONSTRUCT query."@en;
    rdfs:subClassof reg:SPARQLQuery;
    .

reg:query a owl:DatatypeProperty;
    rdfs:label "query"@en;
    rdfs:comment "The source of a SPARQL query"@en;
    rdfs:range  xsd:string;
    .

# -- Tagging support ------------------------------------------------------

reg:release a owl:ObjectProperty;
    rdfs:label "release"@en;
    rdfs:comment "A tagged snapshot of a register"@en;
    rdfs:domain reg:Register;
    rdfs:range  prov:Collection;
    .

reg:tag a owl:DatatypeProperty;
    rdfs:label "tag"@en;
    rdfs:comment "The tag used to label a collection which snapshots the state of a register"@en;
    rdfs:domain prov:Collection;
    rdfs:range xsd:string;
    .

# -- Extending LDP for inverse membership ----------------------------------

reg:inverseMembershipPredicate a owl:ObjectProperty;
    rdfs:label "inverse membership predicate"@en;
    rdfs:comment "Indicates a property which links a member of a collection back to the collection itself, this is the reverse direction to the normal ldp:membershipPredicate"@en;
    rdfs:domain ldp:Container;
    rdfs:range  rdf:Property;
    .


# -- Alias management ------------------------------------------------------

reg:alias    a owl:ObjectProperty;
    vs:term_status "experimental";
    rdfs:label "alias"@en;
    rdfs:comment "An alternative URI for the entity, the alias resource is regarded by this register as owl:sameAs the definition entity"@en;
    rdfs:domain reg:RegisterItem;
    rdfs:range  reg:EntityReference;
    .

reg:representationOf a owl:ObjectProperty;
    vs:term_status "experimental";
    rdfs:label "representation of"@en;
    rdfs:comment "A resource, typically a real-world object, which the registered entity is a representation for."@en;
    rdfs:domain reg:RegisterItem;
    .

# -- Delegation ------------------------------------------------------

reg:Delegated a owl:Class;
    rdfs:label "Delegated"@en;
    rdfs:comment "A registerable entity which represents some form of delegation"@en;
    rdfs:subClassOf [owl:onProperty reg:delegationTarget;     owl:cardinality    1];
    .

reg:delegationTarget a owl:ObjectProperty;
    rdfs:label "delegation target"@en;
    rdfs:comment "A resource to which the delegated register delegates, may be a register in another registry service, a SPARQL endpoint or some other web resource"@en;
    rdfs:domain reg:Delegated;
    rdfs:range  rdfs:Resource;
    .

reg:NamespaceForward a owl:Class;
    rdfs:label "Namespace Forward"@en;
    rdfs:comment "A registerable entity which simply forwards all requests to the delegation target."@en;
    rdfs:subClassOf reg:Delegated;
    rdfs:subClassOf [owl:onProperty reg:forwardingCode;     owl:maxCardinality    1];
    .

reg:forwardingCode a owl:DatatypeProperty;
    rdfs:label "forwarding code"@en;
    rdfs:comment "The HTTP status code to return the requester in order to forward the request."@en;
    rdfs:domain reg:NamespaceForward;
    rdfs:range xsd:int;
    .

reg:FederatedRegister a owl:Class;
    rdfs:label "Federated Register"@en;
    rdfs:comment "A registerable entity which forwards all requests to a remote register. Queries which traverse the register hierarchy such as entity search will also be forwarded"@en;
    rdfs:subClassOf reg:Delegated, reg:Register;
    .

reg:DelegatedRegister a owl:Class;
    rdfs:label "Delegated Register"@en;
    rdfs:comment "A register whose member contents are determined through delegation to a SPARQL endpoint"@en;
    rdfs:subClassOf reg:Delegated, reg:Register;
    rdfs:subClassOf [owl:onProperty reg:enumerationSubject;     owl:maxCardinality    1];
    rdfs:subClassOf [owl:onProperty reg:enumerationPredicate;     owl:maxCardinality    1];
    rdfs:subClassOf [owl:onProperty reg:enumerationObject;     owl:maxCardinality    1];
    .

reg:enumerationSubject a owl:ObjectProperty;
    rdfs:label "enumeration subject"@en;
    rdfs:comment "Specifies the subject part of a triple pattern used to enumerate the members of a delegated register"@en;
    rdfs:domain reg:DelegatedRegister;
    rdfs:range  rdfs:Resource;
    .

reg:enumerationPredicate a owl:ObjectProperty;
    rdfs:label "enumeration predicate"@en;
    rdfs:comment "Specifies the predicate part of a triple pattern used to enumerate the members of a delegated register"@en;
    rdfs:domain reg:DelegatedRegister;
    rdfs:range  rdfs:Resource;
    .

reg:enumerationObject a owl:ObjectProperty;
    rdfs:label "enumeration object"@en;
    rdfs:comment "Specifies the object part of a triple pattern used to enumerate the members of a delegated register"@en;
    rdfs:domain reg:DelegatedRegister;
    rdfs:range  rdfs:Resource;
    .

# -- Dataset metadata ------------------------------------------------------

reg:sourceDataset a owl:ObjectProperty;
    rdfs:label "source dataset"@en;
    rdfs:comment "Gives the source dataset in a Linkset, the other link target is assumed to be the destination"@en;
    rdfs:domain void:Linkset;
    rdfs:range void:Dataset;
    .
